package com.andyou.modules.home;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.andyou.common.utils.StringUtils;
import com.andyou.modules.sys.entity.User;
import com.andyou.modules.sys.service.SystemService;
import com.andyou.modules.sys.service.UserService;

@Controller
@RequestMapping(value = "${adminPath}/demo")
public class DemoController {

	@Autowired
	private SystemService systemService;
	@Autowired
	private UserService userService;
	
	@ModelAttribute
	public User get(@RequestParam(required = false) String id) {
		if (StringUtils.isNotBlank(id)) {
			return systemService.getUser(id);
		} else {
			return new User();
		}
	}
	
	@RequestMapping(value = {"demoForm"})
	public String index(){
		return "modules/demo/formDemo"; 
	}

}
